package com.jsb.dao;

import com.jsb.dao.core.AbstractDao;
import com.jsb.dao.datasource.DatabaseContextHolder;
import com.jsb.dao.datasource.DatabaseType;
import com.jsb.dao.mapper.UserMapper;
import com.jsb.dao.model.User;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * Created by jince on 2017/1/24.
 */
@Repository
public class UserDao extends AbstractDao{

    @Autowired
    private UserMapper mapper;

    public UserDao(SqlSession sqlSession) {
        super(sqlSession);
    }

    public User getUser(int id) {
        DatabaseContextHolder.setDatabaseType(DatabaseType.jsb_trade_v2);
        return mapper.getUser(id);
    }
}
